/******************************************************************************/
/*                                                                            */
/*  Copyright (c) 2009: ngi-central.org                                       */
/*  All rights reserved.                                                      */
/*                                                                            */
/******************************************************************************/


#include <boost/test/unit_test.hpp>

#include "..\..\include\sgl\flusser_moments.h"

BOOST_AUTO_TEST_SUITE( flusser_moments )


BOOST_AUTO_TEST_CASE( flusser_moments__default_constructor )
{
	sgl::flusser_moments<> a;

	BOOST_CHECK( a.fm1() == 0 );
	BOOST_CHECK( a.fm2() == 0 );
	BOOST_CHECK( a.fm3() == 0 );
	BOOST_CHECK( a.fm4() == 0 );

	sgl::flusser_moments<> b(1, 2, 3, 4);

	BOOST_CHECK( b.fm1() == 1 );
	BOOST_CHECK( b.fm2() == 2 );
	BOOST_CHECK( b.fm3() == 3 );
	BOOST_CHECK( b.fm4() == 4 );
}

BOOST_AUTO_TEST_CASE( flusser_moments__copy_constructor )
{
	sgl::flusser_moments<> a(
		sgl::flusser_moments<>(1, 2, 3, 4));

	BOOST_CHECK( a.fm1() == 1 );
	BOOST_CHECK( a.fm2() == 2 );
	BOOST_CHECK( a.fm3() == 3 );
	BOOST_CHECK( a.fm4() == 4 );
}

BOOST_AUTO_TEST_CASE( normalized_moments__conversion_copy_constructor )
{
	sgl::flusser_moments<> a(
		sgl::central_moments<>(1, 1, 2, 3, 4, 5, 6, 7));

	BOOST_CHECK( a.fm1() == -1 );
	BOOST_CHECK( a.fm2() == 0 );
	BOOST_CHECK( a.fm3() == 0 );
	BOOST_CHECK( a.fm4() == 0 );
}

BOOST_AUTO_TEST_CASE( flusser_moments__copy_assignment )
{
	sgl::flusser_moments<> a;
	a = sgl::flusser_moments<>(1, 2, 3, 4);

	BOOST_CHECK( a.fm1() == 1 );
	BOOST_CHECK( a.fm2() == 2 );
	BOOST_CHECK( a.fm3() == 3 );
	BOOST_CHECK( a.fm4() == 4 );
}

BOOST_AUTO_TEST_CASE( flusser_moments__swap )
{
	sgl::flusser_moments<> a(
		sgl::flusser_moments<>(1, 2, 3, 4));
	sgl::flusser_moments<> b;

	a.swap(b);

	BOOST_CHECK( a.fm1() == 0 );
	BOOST_CHECK( a.fm2() == 0 );
	BOOST_CHECK( a.fm3() == 0 );
	BOOST_CHECK( a.fm4() == 0 );
	BOOST_CHECK( b.fm1() == 1 );
	BOOST_CHECK( b.fm2() == 2 );
	BOOST_CHECK( b.fm3() == 3 );
	BOOST_CHECK( b.fm4() == 4 );

	b.swap(a);

	BOOST_CHECK( a.fm1() == 1 );
	BOOST_CHECK( a.fm2() == 2 );
	BOOST_CHECK( a.fm3() == 3 );
	BOOST_CHECK( a.fm4() == 4 );
	BOOST_CHECK( b.fm1() == 0 );
	BOOST_CHECK( b.fm2() == 0 );
	BOOST_CHECK( b.fm3() == 0 );
	BOOST_CHECK( b.fm4() == 0 );
}

BOOST_AUTO_TEST_CASE( flusser_moments__fm1 )
{
	sgl::flusser_moments<> a;

	BOOST_CHECK( a.fm1() == 0 );

	a.fm1() = 1;

	BOOST_CHECK( a.fm1() == 1 );
}

BOOST_AUTO_TEST_CASE( flusser_moments__fm2 )
{
	sgl::flusser_moments<> a;

	BOOST_CHECK( a.fm2() == 0 );

	a.fm2() = 1;

	BOOST_CHECK( a.fm2() == 1 );
}

BOOST_AUTO_TEST_CASE( flusser_moments__fm3 )
{
	sgl::flusser_moments<> a;

	BOOST_CHECK( a.fm3() == 0 );

	a.fm3() = 1;

	BOOST_CHECK( a.fm3() == 1 );
}

BOOST_AUTO_TEST_CASE( flusser_moments__fm4 )
{
	sgl::flusser_moments<> a;

	BOOST_CHECK( a.fm4() == 0 );

	a.fm4() = 1;

	BOOST_CHECK( a.fm4() == 1 );
}

BOOST_AUTO_TEST_CASE( flusser_moments__operator_equality )
{
	sgl::flusser_moments<> a;
	sgl::flusser_moments<> b;

	BOOST_CHECK( a == b );

	sgl::flusser_moments<> c(1, 2, 3, 4);
	sgl::flusser_moments<> d(1, 2, 3, 4);

	BOOST_CHECK( c == d );
}

BOOST_AUTO_TEST_CASE( flusser_moments__operator_inequality )
{
	sgl::flusser_moments<> a;
	sgl::flusser_moments<> b(1, 2, 3, 4);

	BOOST_CHECK( a != b );
}

BOOST_AUTO_TEST_SUITE_END()

